Skip to content

fix(e2e): wait for the settings bounce in the password generator spec - #123

Merged
Rushaway merged 20 commits into
mainfrom
fix/e2e-password-generator-bounce
Nov 29, 2026
Merged

Rushaway merged 20 commits into
mainfrom
fix/e2e-password-generator-bounce

Conversation

@Rushaway

@Rushaway Rushaway commented Nov 29, 2026 •

Copy link
Copy Markdown
Member

Problem

password-generator.spec.ts › "Settings > Main saves the generator defaults" failed on a CI run (NiDE fork, run 46249564687 attempt 1):

Error: page.goto: net::ERR_ABORTED at http://localhost/index.php?p=admin&c=settings&section=settings
  > 137 |             await page.goto(route);

It passed on retry, and failOnFlakyTests correctly made the run red (#115).

After a settings save, admin.settings.php renders a script that bounces back to the same URL with a GET (location.href, at once or after the toast). The spec waited for the POST response and then called page.goto(route) itself, which raced with that bounce and was sometimes aborted by it.

Change

The spec waits for the bounce (a GET navigation response to section=settings, status 200, then load) and asserts on that page, instead of starting a second navigation. Same assertions; nothing else changes.

Checked

  • Local dev stack (isolated compose override), CI=1 ./sbpp.sh e2e specs/flows/password-generator.spec.ts --project=chromium --repeat-each=10: 50 passed.
  • With temporary logging: the only navigation after the POST is the bounce GET (here 9 ms after the POST response), and no other navigation follows within 2 s, so the wait cannot catch an unrelated request.
  • CI green on this PR (PHPUnit, E2E 3 shards, PHPStan, ts-check).
  • tsc over the e2e suite: no error in this file (the 15 existing errors are elsewhere and unchanged).

Version

2.2.32 -> 2.2.33 (stacked on #122)

Merge order

Stack for #115, squash one at a time from the bottom:

  1. chore(ci): cancel the outdated run when a pull request is pushed again #116 chore(ci): cancel the outdated run on a new PR push (2.2.26)
  2. chore(ci): run PHPUnit and E2E nightly on main instead of on every push #117 chore(ci): PHPUnit + E2E nightly on main instead of on every push (2.2.27)
  3. perf(tests): seed the fixture admin with a precomputed password hash #118 perf(tests): precomputed fixture admin password hash (2.2.28)
  4. chore(ci): run the PHPUnit MariaDB on tmpfs without fsync #119 chore(ci): PHPUnit MariaDB on tmpfs without fsync (2.2.29)
  5. chore(ci): run the Playwright E2E suite as three parallel shards #120 chore(ci): Playwright E2E as three parallel shards (2.2.30)
  6. perf(tests): reset the fixture tables with DELETE instead of TRUNCATE #121 perf(tests): fixture reset with DELETE instead of TRUNCATE (2.2.31)
  7. chore(ci): build the E2E dev image with the GitHub Actions cache #122 chore(ci): E2E dev image built with the gha cache (2.2.32)
  8. fix(e2e): wait for the settings bounce in the password generator spec #123 fix(e2e): password generator spec waits for the settings bounce (2.2.33)

Every workflow that runs on pull requests gets a concurrency group keyed
on the PR number, with cancel-in-progress. Other events (push, tag,
schedule, manual) key on the run id, so they never cancel or queue
behind each other.

Refs #115
The merged commit already passed both suites on its pull request. A push
to main now runs only the fast gates (PHPStan, ts-check, API contract,
plugin build). PHPUnit and the Playwright E2E suite run on pull
requests, every night on main, and on demand.

Refs #115
Fixture::reset() runs before every test and re-seeded the admin row with
a fresh password_hash(). bcrypt costs 12 by default since PHP 8.4, about
0.22 s a hash, so ~1,770 resets spent most of the PHPUnit run hashing
the same password. The hash is now computed once per process.

BansTest (80 tests) locally: 24 s -> 8 s, same assertions.

Refs #115
Fixture::reset() truncates and re-seeds every table before each test,
so the job was bound by fsync. MariaDB now starts from a step (a service
container cannot pass server options) with its datadir on tmpfs,
innodb_flush_log_at_trx_commit=0, no doublewrite buffer and no binlog.
It boots while PHP and Composer install, listens on a free loopback
port, has a per-run name, and is removed when the job ends, so a
self-hosted runner keeps no leftover container.

BansTest (80 tests) locally: 43-49 s on disk -> 8-9 s on tmpfs.

Refs #115
The suite ran on one worker because every spec shares the
sourcebans_e2e database. Each shard now brings up its own dev stack and
database and runs --shard=N/3, so workers: 1 no longer sets the total
time. From the per-test durations of the PR #114 run (428 s of tests),
the three contiguous slices carry 158 / 132 / 138 s. fail-fast is off,
so a red run still lists every failing spec, and on failure a report job
merges the shards' blob reports into the usual playwright-report
artifact.

Refs #115
Hashing once per process still cost 0.22 s in every
#[RunInSeparateProcess] child (165 tests) and on every E2E reset, which
runs in a fresh process. The fixture now seeds a precomputed cost-12
bcrypt hash of 'admin': same password, cost and format, and
password_needs_rehash() stays false.

Refs #115
TRUNCATE is DDL that recreates each tablespace: 27 of them took 65-125
ms per reset on MariaDB 10.11 with a tmpfs datadir, and the reset runs
before every test. The fixture now DELETEs every table and runs
ALTER TABLE ... AUTO_INCREMENT = 1 only where information_schema shows
the counter moved (MySQL 8's cached value is switched off for the
session). Same end state, ~12 ms per reset. The E2E reset shim shares
this code.

Full suite locally (tmpfs DB): 235 s -> 176 s, same 1,770 tests.

Refs #115
Every E2E shard built the dev web image from scratch inside
docker compose up (62 s of the 93 s bring-up on the PR #114 run). The
image is now built by buildx with the gha cache under the tag
docker-compose.yml uses, so compose finds it and skips its build. Only
shard 1 writes the cache; the nightly run on main fills the scope that
pull requests read.

Refs #115
After saving Settings > Main, the page bounces back to the same URL
with its own GET. The spec navigated there again right after the POST
response, and that page.goto() was sometimes aborted by the bounce
(net::ERR_ABORTED, failed once on a CI run and passed on retry, which
failOnFlakyTests turns red). The spec now waits for the bounce and
asserts on that page.

Refs #115
@Rushaway Rushaway added bug Something isn't working priority: medium Normal priority area: ci GitHub Actions workflows and test harness labels Nov 29, 2026
@Rushaway
Rushaway marked this pull request as ready for review November 29, 2026 15:41
@Rushaway
Rushaway merged commit 1b772ac into main Nov 29, 2026
8 checks passed
@Rushaway
Rushaway deleted the fix/e2e-password-generator-bounce branch November 29, 2026 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ci GitHub Actions workflows and test harness bug Something isn't working priority: medium Normal priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant